<template>
	<div id="prodam01">

		<el-dialog title="新增查勘记录" :visible.sync="dialogFormVisible">
			<div class="bjys">查勘报告</div>
			<el-form :model="form" label-width="100px" style="margin-top: 10px;">
				<el-col :span="11">
					<el-form-item label="出险时间:">
						<el-input v-model="CaseDataCheck.dangerTime" autocomplete="off" disabled></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="11" :offset="2">
					<el-form-item label="出险原因:">
						<el-select v-model="CaseDataCheck.dangerCause" placeholder="请选择" disabled>
							<el-option label="碰撞" value="碰撞"></el-option>
							<el-option label="自燃" value="自燃"></el-option>
							<el-option label="划痕" value="划痕"></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="11">
					<el-form-item label="报案时间:">
						<el-input v-model="CaseDataCheck.reportCaseTime" autocomplete="off" disabled></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="11" :offset="2">
					<el-form-item label="查勘时间:">
						<el-date-picker v-model="form.surveyLossTime" format="yyyy-MM-dd" value-format="yyyy-MM-dd" type="date"
						 placeholder="选择日期">
						</el-date-picker>
					</el-form-item>
				</el-col>
				<el-col :span="11">
					<el-form-item label="联系电话:">
						<el-input v-model="form.telephone" autocomplete="off"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="11" :offset="2">
					<el-form-item label="事故类型:">
						<el-select v-model="form.disposeType" placeholder="请选择">
							<el-option label="单方事故" :value="1"></el-option>
							<el-option label="双方事故" :value="2"></el-option>
							<el-option label="三方事故" :value="3"></el-option>
							<el-option label="多方事故" :value="4"></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="11">
					<el-form-item label="地点所在省:">
						<el-select v-model='CaseDataCheck.location' @change="changeCity();changeCity1();" disabled>
							<el-option :key="i" v-for="(item,i) in items" :value="item.name"></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="11" :offset="2">
					<el-form-item label="地点所在市:">
						<el-select v-model='CaseDataCheck.city' @change="changeCity1()" disabled>
							<el-option :key="i" v-for="(item,i) in cityArr" :value="item.name"></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="11">
					<el-form-item label="地点所在区县:">
						<el-select v-model='CaseDataCheck.county' disabled>
							<el-option :key="i" v-for="(item,i) in cityArr1" :value="item.name"></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="11" :offset="2">
					<el-form-item label="驾驶证:">
						<el-input v-model="form.drivingLoicence" autocomplete="off"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="11">
					<el-form-item label="行驶证:">
						<el-input v-model="form.vehicleLicense" autocomplete="off"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="11" :offset="2">
					<el-form-item label="车牌号:">
						<el-input v-model="CaseDataCheck.plateNumber" autocomplete="off" disabled></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item label="查勘地点:">
						<el-input v-model="form.surveyLossAddress" autocomplete="off"></el-input>
					</el-form-item>
				</el-col>

				<el-col :span="24">
					<el-form-item label="查勘意见:">
						<el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.prospectDisposeIdea">
						</el-input>
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item label="出险经过:">
						<el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="CaseDataCheck.dangerPass" disabled>
						</el-input>
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item label="损失情况:">
						<el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="form.lossInfo">
						</el-input>
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item label="责任判断:">
						<el-radio-group v-model="form.duty">
							<el-radio :label="1">全部责任</el-radio>
							<el-radio :label="2">主要责任</el-radio>
							<el-radio :label="3">同等责任</el-radio>
							<el-radio :label="4">次要责任</el-radio>
							<el-radio :label="5">无责任</el-radio>
						</el-radio-group>
					</el-form-item>
				</el-col>
				<el-col :span="11">
					<el-form-item label="比例(百分比):">
						<el-input placeholder="请输入内容" v-model="form.dutyRatio">
						</el-input>
					</el-form-item>
				</el-col>
				<el-col :span="11" :offset="2">
					<el-form-item label="维修点:">
						<el-input placeholder="请输入内容" v-model="form.maintenancePoint">
						</el-input>
					</el-form-item>
				</el-col>
				<!-- <div class="bjys">出险司机信息</div> -->
				<el-col :span="11">
					<el-form-item label="出险司机:">
						<el-input v-model="CaseDataCheck.driver" autocomplete="off" disabled></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="11" :offset="2">
					<el-form-item label="联系电话:">
						<el-input v-model="CaseDataCheck.driverMob" autocomplete="off" disabled></el-input>
					</el-form-item>
				</el-col>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="dialogFormVisible = false">取 消</el-button>
				<el-button type="primary" @click="subins">确 定</el-button>
			</div>
		</el-dialog>

		<el-dialog title="修改" :visible.sync="dialogSelectVisible">
			<el-form :model="DataDemo" label-width="80px">
				<el-col :span="11">
					<el-form-item label="查勘编号:">
						<el-input v-model="DataDemo.surveyLossId" autocomplete="off"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="11" :offset="2">
					<el-form-item label="查勘状态:">
						<el-select v-model="DataDemo.prospectState" placeholder="请选择">
							<el-option label="通过" :value="1"></el-option>
							<el-option label="暂存" :value="2"></el-option>
							<el-option label="注销" :value="3"></el-option>
						</el-select>
					</el-form-item>
				</el-col>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="dialogSelectVisible = false">取 消</el-button>
				<el-button type="primary" @click="subSelect">确 定</el-button>
			</div>
		</el-dialog>

		<el-dialog title="查勘审核" :visible.sync="dialogDataDemoVisible">
			<div class="bjys">出险信息</div>
			<el-form :model="CaseDataCheck" label-width="100px" style="margin-top: 10px;">
				<el-col :span="11">
					<el-form-item label="报案人:">
						<el-input v-model="CaseDataCheck.informants" autocomplete="off" disabled></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="11" :offset="2">
					<el-form-item label="出险司机:">
						<el-input v-model="CaseDataCheck.driver" autocomplete="off" disabled></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="11">
					<el-form-item label="司机电话:">
						<el-input v-model="CaseDataCheck.driverMob" autocomplete="off" disabled></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="11" :offset="2">
					<el-form-item label="出险时间:">
						<el-input v-model="CaseDataCheck.dangerTime" autocomplete="off" disabled></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="11">
					<el-form-item label="地点所在省:">
						<el-select v-model='CaseDataCheck.location' @change="changeCity();changeCity1();" disabled>
							<el-option :key="i" v-for="(item,i) in items" :value="item.name"></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="11" :offset="2">
					<el-form-item label="地点所在市:">
						<el-select v-model='CaseDataCheck.city' @change="changeCity1()" disabled>
							<el-option :key="i" v-for="(item,i) in cityArr" :value="item.name"></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="11">
					<el-form-item label="地点所在区县:">
						<el-select v-model='CaseDataCheck.county' disabled>
							<el-option :key="i" v-for="(item,i) in cityArr1" :value="item.name"></el-option>
						</el-select>
					</el-form-item>
				</el-col>

				<el-col :span="11" :offset="2">
					<el-form-item label="出险详细地址:">
						<el-input type="textarea" v-model="CaseDataCheck.fullAddress" disabled></el-input>
					</el-form-item>
				</el-col>

				<el-col :span="24">
					<el-form-item label="出险经过:">
						<el-input type="textarea" v-model="CaseDataCheck.dangerPass" disabled></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item label="出险原因:">
						<el-input type="textarea" v-model="CaseDataCheck.dangerCause" disabled></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="11">
					<span>*确认出险现场信息的属实性并属保险责任为<span style="color: red;">通过</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
					<span>*如仍不属公司保险责任为<span style="color: red;">注销</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
					<span>*如仍需进一步调查确认报案信息为<span style="color: red;">暂存</span></span>
				</el-col>
				<el-col :span="11" :offset="2">
					<el-form-item label="确认查勘状态:">
						<el-select v-model="DataDemo.prospectState" placeholder="请选择">
							<el-option label="通过" :value="1"></el-option>
							<el-option label="暂存" :value="2"></el-option>
							<el-option label="注销" :value="3"></el-option>
						</el-select>
					</el-form-item>
				</el-col>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="dialogDataDemoVisible = false">取 消</el-button>
				<el-button type="primary" @click="subCheck">确 定</el-button>
			</div>
		</el-dialog>

		<el-dialog title="上传现场照片" :visible.sync="dialogUploadVisible">
			<el-upload class="upload-demo" ref="upload" name="uploadimg" enctype="multipart/form-data" action="http://localhost:6001/user/uploadImgs"
			 :on-preview="handlePreview" :on-remove="handleRemove" :file-list="fileList" :auto-upload="false">
				<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
				<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
				<div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
			</el-upload>
			<div slot="footer" class="dialog-footer">
				<el-button @click="dialogUploadVisible = false">取 消</el-button>
				<el-button type="primary" @click="subUpload">确 定</el-button>
			</div>
		</el-dialog>

		<el-dialog title="定损明细信息" :visible.sync="dialogLossVisible">
			<div class="bjys">基本信息</div>
			<el-form :model="CaseDataCheck" label-width="100px" style="margin-top: 10px;">
				<el-col :span="8">
					<el-form-item label="报案编号:">
						<el-input v-model="CaseDataCheck.caseId" disabled></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item label="查勘编号:">
						<el-input v-model="DataDemo.surveyLossId" disabled></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="8">
					<el-form-item label="保单编号:">
						<el-input v-model="CaseDataCheck.warrantyId" disabled></el-input>
					</el-form-item>
				</el-col>
			</el-form>
			<div style="margin: 20px 0px;color: red;">车损明细</div>
			<!-- v-if="CxianData.indexOf(1) != -1" -->
			<el-table :data="CheData" style="width: 100%" highlight-current-row>
				<el-table-column label="车损险别" width="180">
					<template slot-scope="scope">
						<el-select v-model="scope.row.carDanger" disabled>
							<el-option v-for="(item,i) in RiskType" :key="i" :label="item.riskTypeName" :value="item.riskTypeId+''"></el-option>
						</el-select>
					</template>
				</el-table-column>
				<el-table-column label="车牌号码" width="160">
					<template slot-scope="scope">
						<el-input v-model="scope.row.cplateNumber" disabled></el-input>
					</template>
				</el-table-column>
				<el-table-column label="定损单价" width="130">
					<template slot-scope="scope">
						<el-input v-model="scope.row.carPrice"></el-input>
					</template>
				</el-table-column>
				<el-table-column label="车损工时" width="130">
					<template slot-scope="scope">
						<el-input v-model="scope.row.carFormula"></el-input>
					</template>
				</el-table-column>
				<el-table-column label="车损小计" width="120">
					<template slot-scope="scope">
						<el-input :value="scope.row.carSubtotal = parseFloat(scope.row.carPrice) + parseFloat(parseFloat(scope.row.carFormula) * 200)"
						 disabled></el-input>
					</template>
				</el-table-column>
			</el-table>
			<el-select v-if="SpecialJurisdictions.indexOf('checkck') != -1" v-model="lossStatusOne" placeholder="请选择" style="margin-top: 20px;">
				<el-option label="通过" :value="1"></el-option>
				<el-option label="未通过" :value="2"></el-option>
			</el-select>
			<!-- v-if="WxianData.indexOf(10) != -1" -->
			<div style="margin: 20px 0px;color: red;">物损明细</div>
			<el-table :data="WuData" style="width: 100%" highlight-current-row>
				<el-table-column prop="matterDanger" label="物损险别" width="180">
					<template slot-scope="scope">
						<el-select v-model="scope.row.matterDanger" placeholder="暂无" disabled>
							<el-option v-for="item in RiskType" :key="item.riskTypeId" :label="item.riskTypeName" :value="item.riskTypeId+''"></el-option>
						</el-select>
					</template>
				</el-table-column>
				<el-table-column label="物损程度" width="160">
					<template slot-scope="scope">
						<el-input v-model="scope.row.matterDegree"></el-input>
					</template>
				</el-table-column>
				<el-table-column label="物损单价" width="140">
					<template slot-scope="scope">
						<el-input v-model="scope.row.matterPrice"></el-input>
					</template>
				</el-table-column>
				<el-table-column label="物损小计" width="140">
					<template slot-scope="scope">
						<el-input :value="scope.row.matterSubtotal = parseFloat(scope.row.matterPrice * 1.4)" disabled></el-input>
					</template>
				</el-table-column>
				<!-- 				<el-table-column label="审核" >
					<template slot-scope="scope">
						<el-select v-model="scope.row.mstate" placeholder="请选择">
							<el-option label="通过" :value="1"></el-option>
							<el-option label="未通过" :value="2"></el-option>
						</el-select>
					</template>
				</el-table-column> -->
			</el-table>
			<el-select v-if="SpecialJurisdictions.indexOf('checkck') != -1" v-model="lossStatusTwo" placeholder="请选择" style="margin-top: 20px;">
				<el-option label="通过" :value="1"></el-option>
				<el-option label="未通过" :value="2"></el-option>
			</el-select>
			<div style="margin: 20px 0px;color: red;">人伤明细</div>
			<!-- v-if="RxianData.indexOf(4) != -1" -->
			<el-table :data="RenData" style="width: 100%" highlight-current-row>
				<el-table-column prop="matterDanger" label="人伤险别" width="180">
					<template slot-scope="scope">
						<el-select v-model="scope.row.userDanger" placeholder="暂无" disabled>
							<el-option v-for="item in RiskType" :key="item.riskTypeId" :label="item.riskTypeName" :value="item.riskTypeId+''"></el-option>
						</el-select>
					</template>
				</el-table-column>
				<el-table-column label="伤者姓名" width="140">
					<template slot-scope="scope">
						<el-input v-model="scope.row.userName"></el-input>
					</template>
				</el-table-column>
				<el-table-column label="伤情判断" width="140">
					<template slot-scope="scope">
						<el-input v-model="scope.row.judgment"></el-input>
					</template>
				</el-table-column>
				<el-table-column label="费用类别" width="140">
					<template slot-scope="scope">
						<el-input v-model="scope.row.priceType"></el-input>
					</template>
				</el-table-column>
				<el-table-column label="人损小计" width="120">
					<template slot-scope="scope">
						<el-input v-model="scope.row.userSubtotal"></el-input>
					</template>
				</el-table-column>
			</el-table>
			<el-select v-if="SpecialJurisdictions.indexOf('checkck') != -1" v-model="lossStatusThree" placeholder="请选择" style="margin-top: 20px;">
				<el-option label="通过" :value="1"></el-option>
				<el-option label="未通过" :value="2"></el-option>
			</el-select>
			<div slot="footer" class="dialog-footer">
				<el-button @click="dialogLossVisible = false">取 消</el-button>
				<el-button type="primary" @click="subLoss">确 定</el-button>
			</div>
		</el-dialog>

		<el-dialog title="理赔派工信息" :visible.sync="dialogSettVisible">
			<el-form label-width="100px" style="margin-top: 10px;">
				<el-col :span="24">
					<el-form-item label="理赔派工:">
						<el-select v-model="SettUserId" placeholder="请选择">
							<el-option v-for="item in SysSettData" :key="item.userId" :label="item.username" :value="item.userId">
							</el-option>
						</el-select>
					</el-form-item>
				</el-col>
			</el-form>
			<el-table ref="multipleTable" :data="LossDataAll" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange">
				<el-table-column type="selection" width="55">
				</el-table-column>
				<el-table-column prop="caseId" label="报案编号" width="180">
				</el-table-column>
				<el-table-column prop="lossTime" label="定损时间" width="120">
				</el-table-column>
				<el-table-column prop="lossSum" label="定损总额" width="120">
				</el-table-column>
				<el-table-column label="定损状态" show-overflow-tooltip>
					<template slot-scope="scope">
						<el-select v-model="scope.row.lossStatus" disabled>
							<el-option label="通过" :value="1"></el-option>
							<el-option label="未处理" :value="2"></el-option>
							<el-option label="暂存" :value="3"></el-option>
							<el-option label="待修改" :value="4"></el-option>
							<el-option label="撤销" :value="5"></el-option>
						</el-select>
					</template>
				</el-table-column>
			</el-table>
			<div slot="footer" class="dialog-footer">
				<el-button @click="dialogSettVisible = false">取 消</el-button>
				<el-button type="primary" @click="subSett">确 定</el-button>
			</div>
		</el-dialog>

		<el-container>
			<el-header>
				<el-row :gutter="20">
					<el-col :span="3">
						<div class="grid-content bg-purple">车险理赔系统</div>
					</el-col>
					<el-col :span="2" :offset="14">
						<div class=" bg-purple font1">欢迎您</div>
					</el-col>
					<el-col :span="2">
						<div class=" bg-purple font1">{{uname}}</div>
					</el-col>
					<el-col :span="2">
						<div class=" bg-purple font1"><a class="hover1" @click="exit">安全退出</a></div>
					</el-col>
				</el-row>
			</el-header>
			<el-main>
				<el-tabs v-model="tymodel" type="card" @tab-click="handleClick">
					<el-tab-pane label="待处理信息" name="right">
						<el-form label-width="100px" class="demo-ruleForm fo">
							<el-form-item>
								<el-button type="primary" @click="subquanbu()">全部任务</el-button>
							</el-form-item>
							<el-form-item>
								<el-button type="primary" @click="subguoqi()">已过期任务</el-button>
							</el-form-item>
							<el-form-item>
								<el-button type="primary" @click="subwancheng()">已处理任务</el-button>
							</el-form-item>
							<el-form-item>
								<el-button type="primary" @click="subzhixing()">待处理任务</el-button>
							</el-form-item>
							<el-form-item v-if="Jurisdictions.indexOf('insert') != -1">
								<el-button type="primary" icon="el-icon-plus" @click="addProspect"></el-button>
							</el-form-item>
						</el-form>
						<el-table :data="tableData2" style="width: 100%" highlight-current-row @current-change="handleCurrentChange2"
						 :default-sort="{prop: 'date', order: 'descending'}">
							<el-table-column prop="caseId" label="案件编号" width="180">
							</el-table-column>
							<el-table-column prop="dangerTime" label="出险时间" width="140">
							</el-table-column>
							<el-table-column prop="fullAddress" label="出险详细地址" width="180">
							</el-table-column>
							<el-table-column prop="driverMob" label="联系电话" width="140">
							</el-table-column>
							<el-table-column prop="caseHandling" label="报案处理" width="140">
								<template slot-scope="scope">
									{{zhcaseHandling(scope.row.caseHandling)}}
								</template>
							</el-table-column>
							<el-table-column prop="dispatchedWorkerTime" label="开始时间" width="160">
							</el-table-column>
							<el-table-column prop="dispatchedWorkerEndTime" label="结束时间">
							</el-table-column>
						</el-table>
					</el-tab-pane>
					<el-tab-pane label="查勘与定损信息列表" name="first">
						<el-form :model="ruleForm" ref="ruleForm" label-width="100px" class="demo-ruleForm fo">
							<el-form-item label="查勘编号" prop="surveyLossId">
								<el-input v-model="ruleForm.surveyLossId"></el-input>
							</el-form-item>
							<el-form-item label="车牌号码" prop="carframeId">
								<el-input v-model="ruleForm.carframeId"></el-input>
							</el-form-item>
							<el-form-item>
								<el-button type="primary" @click="submitForm()">查询</el-button>
								<el-button @click="resetForm()">重置</el-button>
							</el-form-item>
						</el-form>
						<el-tooltip v-if="Jurisdictions.indexOf('update') != -1" content="修改" placement="top">
							<el-button class="button" type="primary" icon="el-icon-edit" @click="updProspect"></el-button>
						</el-tooltip>
						<el-tooltip v-if="Jurisdictions.indexOf('delete') != -1" content="删除" placement="top">
							<el-button class="button" type="primary" icon="el-icon-delete" @click="delProspect"></el-button>
						</el-tooltip>
						<el-tooltip v-if="SpecialJurisdictions.indexOf('check') != -1" content="查勘审核" placement="top">
							<el-button class="button" type="primary" icon="el-icon-document" @click="checkProspect"></el-button>
						</el-tooltip>
						<el-tooltip v-if="SpecialJurisdictions.indexOf('upload') != -1" content="上传现场照片" placement="top">
							<el-button class="button" type="primary" icon="el-icon-upload" @click="uploadImg"></el-button>
						</el-tooltip>
						<el-tooltip v-if="SpecialJurisdictions.indexOf('check') != -1" content="核损审核" placement="top">
							<el-button class="button" type="primary" icon="el-icon-tickets" @click="checkDamages"></el-button>
						</el-tooltip>
						<el-tooltip v-if="SpecialJurisdictions.indexOf('dispatch') != -1" content="理赔调度" placement="top">
							<el-button class="button" type="primary" icon="el-icon-s-custom" @click="dispatchSett"></el-button>
						</el-tooltip>
						<el-table ref="singleTable" :data="tableData" highlight-current-row @current-change="handleCurrentChange" style="width: 100%;height:325px">
							<el-table-column property="surveyLossId" label="查勘定损编号" width="160">
							</el-table-column>
							<el-table-column property="userId" label="派工工号" width="120">
							</el-table-column>
							<el-table-column property="prospectState" label="查勘状态" width="120">
								<template slot-scope="scope">
									{{zhProspectState(scope.row.prospectState)}}
								</template>
							</el-table-column>
							<el-table-column property="disposeType" label="事故分类" width="120">
								<template slot-scope="scope">
									{{zhDisposeType(scope.row.disposeType)}}
								</template>
							</el-table-column>
							<el-table-column property="carframeId" label="车牌号" width="200">
							</el-table-column>
							<el-table-column property="dangerCause" label="出险原因" width="200">
							</el-table-column>
							<el-table-column property="lossInfo" label="损失情况" width="240">
							</el-table-column>
							<el-table-column property="duty" label="责任判断" width="120">
								<template slot-scope="scope">
									{{zhDuty(scope.row.duty)}}
								</template>
							</el-table-column>
							<el-table-column property="dutyRatio" label="责任比例" width="120">
							</el-table-column>
							<el-table-column property="lossStatus" label="核损审核" width="120">
								<template slot-scope="scope">
									{{zhLossStatus(scope.row.lossStatus)}}
								</template>
							</el-table-column>
						</el-table>
					</el-tab-pane>
				</el-tabs>
				<p>一共<span style="color: red;">{{count}}</span>条数据</p>
				<el-pagination @current-change="getpd" current-page.sync="1" hide-on-single-page layout="prev, pager, next, jumper"
				 :total="total">
				</el-pagination>
			</el-main>
		</el-container>
	</div>
</template>

<script>
	export default {
		name: "prodam01",
		data() {
			return {
				uname: sessionStorage.getItem("userName"),
				ruleForm: {
					surveyLossId: 0,
					carframeId: ''
				},
				form: {
					userId: sessionStorage.getItem("userId"),
					surveyLossTime: '',
					surveyLossAddress: '',
					disposeType: 0,
					prospectDisposeIdea: '',
					lossInfo: '',
					duty: 1,
					dutyRatio: 0,
					telephone: '',
					maintenancePoint: '',
					prospectState: 2,
					drivingLoicence: '',
					vehicleLicense: '',
					carframeId: '',
					engineNumber: '',
					isEffective: '',
					settUserId: 0,
					caseId: 0
				},
				tymodel: 'right',
				Jurisdictions: [],
				SpecialJurisdictions: [],
				tableData: [],
				tableData2: [],
				CaseData: [],
				CaseDataCheck: {},
				dialogFormVisible: false,
				count: 0,
				total: 0,
				DataDemo: [],
				dialogSelectVisible: false,
				dialogDataDemoVisible: false,
				items: [{
						name: '北京',
						sub: [{
								name: '北京市',
								sub: [{
									name: '北京市11'
								}, {
									name: '北京市12'
								}, {
									name: '北京市13'
								}]
							},
							{
								name: '北京市2',
								sub: [{
									name: '北京市21'
								}, {
									name: '北京市22'
								}, {
									name: '北京市23'
								}]
							},
						]
					},
					{
						name: '江西',
						sub: [{
								name: '南昌市',
								sub: [{
									name: '高新区'
								}, {
									name: '西湖区'
								}, {
									name: '瑶湖区'
								}]
							},
							{
								name: '赣州市',
								sub: [{
									name: '赣州市1'
								}, {
									name: '赣州市2'
								}, {
									name: '赣州市3'
								}]
							},
							{
								name: '抚州市',
								sub: [{
									name: '抚州市1'
								}, {
									name: '抚州市2'
								}, {
									name: '抚州市3'
								}]
							}
						]
					}
				],
				cityArr: [],
				cityArr1: [],
				dialogUploadVisible: false,
				fileList: [],
				dialogLossVisible: false,
				carframeIdDemo: '',
				dialogSettVisible: false,
				SysSettData: [],
				SettUserId: 0,
				RiskType: [],
				CxianData: [],
				WxianData: [],
				RxianData: [],
				CheData: [],
				WuData: [],
				RenData: [],
				LossData: {},
				lossStatusOne: 0,
				lossStatusTwo: 0,
				lossStatusThree: 0,
				countpd: 0,
				sfwancheng: 0,
				LossDataAll: [],
				multipleSelection: []
			};
		},
		watch: {

		},
		methods: {
			getProspectAll(page) {
				this.$axios.get("/getSurveyLossIdOrCarframeId", {
						params: {
							id: this.ruleForm.surveyLossId,
							carframeId: this.ruleForm.carframeId,
							page: page
						}
					})
					.then(msg => {
						this.tableData = msg.data.list;
						this.total = msg.data.pages * 10;
						this.count = msg.data.total;
					});
			},
			getSpecialJurisdictions() {
				this.$axios.get("/getMenuButton?uid=" + sessionStorage.getItem("userId") + "&jpid=5")
					.then(msg => {
						this.SpecialJurisdictions = msg.data;
					});
			},
			getSettAndOneUser() {
				this.$axios.get("/getSettAndOneUser")
					.then(msg => {
						this.SysSettData = msg.data;
					});
			},
			getLossDeterminationByUserId(caseId) {
				this.$axios.get("/getLossDeterminationByUserId?caseId=" + caseId)
					.then(msg => {
						this.LossData = msg.data;
					});
			},
			getCaseByUserId(page, shuzhi, inbh, endtime) {
				this.$axios.get("/getCaseByUserId?userId=" + sessionStorage.getItem("userId") + "&shuzhi=" + shuzhi + "&inbh=" +
						inbh + "&endtime=" + endtime + "&page=" + page)
					.then(msg => {
						this.tableData2 = msg.data.list;
						this.count = msg.data.total;
						this.total = msg.data.pages * 10;
					});
			},
			getCaseBycaseId() {
				this.$axios.get("/getCaseBycaseId?caseId=" + this.DataDemo.caseId)
					.then(msg => {
						this.CaseDataCheck = msg.data;
					});
			},
			getXianData(type, val) {
				this.$axios.get("/risk/getRiskTypeBycaseId", {
						params: {
							caseId: val,
							type: type
						}
					})
					.then(msg => {
						if (type == 1) {
							this.CxianData = msg.data;
						} else if (type == 2) {
							this.WxianData = msg.data;
						} else {
							this.RxianData = msg.data;
						}
					});
			},
			getChepai() {
				this.$axios.get("/getCaseChepai?caseId=" + this.DataDemo.caseId)
					.then(msg => {
						this.carframeIdDemo = msg.data;
					})
			},
			getpd(page) {
				if (this.countpd == 0) {
					this.getCaseByUserId(page, 1, 0, 0);
				} else {
					this.getProspectAll(page);
				}
			},
			getCheLoss() {
				this.$axios.get("/getCheLoss?caseId=" + this.DataDemo.caseId)
					.then(msg => {
						this.CheData = msg.data;
					});
			},
			getWuLoss() {
				this.$axios.get("/getWuLoss?caseId=" + this.DataDemo.caseId)
					.then(msg => {
						this.WuData = msg.data;
					});
			},
			getRenLoss() {
				this.$axios.get("/getRenLoss?caseId=" + this.DataDemo.caseId)
					.then(msg => {
						this.RenData = msg.data;
					});
			},
			getRiskType() {
				this.$axios.get("/risk/getRiskTypeAll")
					.then(msg => {
						this.RiskType = msg.data;
					});
			},
			getLossDataAll(){
				this.$axios.get("/getLossDataAll")
				.then(msg =>{
					this.LossDataAll = msg.data;
				})
			},
			updSurveyLossProspectState(mssg) {
				this.$axios.post("/updSurveyLossProspectState", {
						surveyLossId: this.DataDemo.surveyLossId,
						prospectState: this.DataDemo.prospectState
					})
					.then(msg => {
						if (msg.data == "成功") {
							this.$notify({
								title: '成功',
								message: mssg,
								type: 'success'
							});
						}
					});
			},
			submitForm() {
				this.getProspectAll(1);
			},
			subquanbu() {
				this.getCaseByUserId(1, 1, 0, 0);
			},
			subguoqi() {
				this.getCaseByUserId(1, 1, 0, 1);
			},
			subwancheng() {
				this.getCaseByUserId(1, 1, 1, 0);
			},
			subzhixing() {
				this.getCaseByUserId(1, 0, 0, 0);
			},
			resetForm() {
				this.ruleForm.surveyLossId = 0;
				this.ruleForm.carframeId = "";
			},
			handleClick(tab) {
				if (tab.label == "查勘与定损信息列表") {
					this.countpd = 1;
					this.getProspectAll(1);
					this.CaseDataCheck = {};
					this.ruleForm.surveyLossId = 0;
					this.ruleForm.carframeId = '';
				} else {
					this.countpd = 0;
				}
			},
			handleCurrentChange(val) {
				this.DataDemo = val;
				this.getLossDeterminationByUserId(val.caseId);
			},
			handleCurrentChange2(val) {
				this.CaseDataCheck = val;
				this.form.caseId = val.caseId;
				this.$axios.get("/getSurveyCountCaseId?caseId=" + val.caseId)
					.then(msg => {
						if (msg.data == "存在") {
							this.sfwancheng = 1;
						} else {
							this.sfwancheng = 0;
						}
					});
			},
			handleSelectionChange(val) {
				this.multipleSelection = val;
			},
			addProspect() {
				if (this.form.caseId == 0 || this.form.caseId == -1) {
					this.$notify({
						title: '提示',
						message: '请选择出险信息',
						type: 'warning'
					});
				} else if (this.zhcaseDispatchedWorkerEndTime(this.CaseDataCheck.dispatchedWorkerEndTime) == "已过期") {
					this.$notify({
						title: '提示',
						message: '出险时间已过',
						type: 'warning'
					});
				} else if (this.sfwancheng == 1) {
					this.$notify({
						title: '提示',
						message: '此出险信息已经查勘或正在查勘中',
						type: 'warning'
					});
				} else {
					this.form.vehicleLicense = '';
					this.form.carframeId = '';
					this.form.surveyLossTime = '';
					this.form.telephone = '';
					this.form.disposeType = 0;
					this.form.surveyLossAddress = '';
					this.form.prospectDisposeIdea = '';
					this.form.lossInfo = '';
					this.form.duty = 1;
					this.form.dutyRatio = 0;
					this.form.maintenancePoint = '';
					this.form.drivingLoicence = '';
					this.getXianData(1, this.CaseDataCheck.caseId);
					this.getXianData(2, this.CaseDataCheck.caseId);
					this.getXianData(3, this.CaseDataCheck.caseId);
					this.dialogFormVisible = true;
				}

			},
			updProspect() {
				if (this.DataDemo.length == 0) {
					this.$notify({
						title: '提示',
						message: '请选择查勘信息',
						type: 'warning'
					});
				} else {
					if (this.DataDemo.prospectState != 3) {
						this.$notify({
							title: '警告',
							message: '修改的查勘状态要为注销状态',
							type: 'warning'
						});
					} else {
						this.dialogSelectVisible = true;
					}
				}
			},
			delProspect() {
				if (this.DataDemo.length == 0) {
					this.$notify({
						title: '提示',
						message: '请选择查勘信息',
						type: 'warning'
					});
				} else {

					this.$confirm('此操作将删除此查勘信息, 是否继续?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						this.$axios.get("/delSurveyLoss?caseId=" + this.DataDemo.caseId)
							.then(msg => {
								if (msg.data == "成功") {
									this.$notify({
										title: '成功',
										message: '删除查勘信息成功',
										type: 'success'
									});
								}
							});
					}).catch(() => {
						this.$notify.info({
							title: '取消',
							message: '已取消删除'
						});
					});
				}
			},
			checkProspect() {
				if (this.DataDemo.length == 0) {
					this.$notify({
						title: '提示',
						message: '请选择查勘信息',
						type: 'warning'
					});
				} else {

					if (this.DataDemo.prospectState == 3) {
						this.$notify({
							title: '警告',
							message: '状态为注销请去修改查勘状态',
							type: 'warning'
						});
					} else {
						this.getCaseBycaseId();
						this.dialogDataDemoVisible = true;
					}

				}
			},
			uploadImg() {
				this.dialogUploadVisible = true;
			},
			checkDamages() {
				if (this.DataDemo.length == 0) {
					this.$notify({
						title: '提示',
						message: '请选择查勘信息',
						type: 'warning'
					});
				} else {
					
					if(this.DataDemo.duty == 5){
						this.$notify({
							title: '提示',
							message: '没有责任不需要定损',
							type: 'warning'
						});
					}else{
						this.getCaseBycaseId();
						this.getChepai();
						this.getXianData(1, this.DataDemo.caseId);
						this.getXianData(2, this.DataDemo.caseId);
						this.getXianData(3, this.DataDemo.caseId);
						this.getCheLoss();
						this.getWuLoss();
						this.getRenLoss();
						this.getRiskType();
						this.dialogLossVisible = true;
					}
				}
			},
			dispatchSett() {
					this.SettUserId = 0;
					this.dialogSettVisible = true;
					this.getLossDataAll();
					this.getSettAndOneUser();
			},
			subins() {
				this.form.carframeId = this.CaseDataCheck.plateNumber;
				//this.form.surveyLossTime = this.form.surveyLossTime.toLocaleDateString();
				this.$axios.post("/insSurveyLoss", this.form)
					.then(msg => {
						if (msg.data == "成功") {
							this.$notify({
								title: '成功',
								message: '新增查勘信息成功',
								type: 'success'
							});
						}
					});
				this.$axios.post("/insLossDetermination", {
						userId: this.form.userId,
						caseId: this.form.caseId
					})
					.then(msg => {
						this.getCaseByUserId(1, 1, 0, 0);
						this.form.caseId = -1;
						this.dialogFormVisible = false;
						for (var i = 0; i < this.CxianData.length; i++) {
							this.$axios.post("/insCheLoss", {
									carDanger: this.CxianData[i],
									cplateNumber: this.CaseDataCheck.plateNumber,
									cstate: 2,
									lossId: msg.data
								})
								.then(msg => {});
						}
						for (var i = 0; i < this.WxianData.length; i++) {
							this.$axios.post("/insWuLoss", {
									matterDanger: this.WxianData[i],
									matterDegree: '暂无',
									mstate: 2,
									lossId: msg.data
								})
								.then(msg => {});
						}
						for (var i = 0; i < this.RxianData.length; i++) {
							this.$axios.post("/insRenLoss", {
									userDanger: this.RxianData[i],
									userName: '请填写',
									judgment: '暂无',
									priceType: '暂无',
									ustate: 2,
									lossId: msg.data
								})
								.then(msg => {});
						}
					});
			},
			subSelect() {
				this.updSurveyLossProspectState("修改查勘状态成功");

				if (this.DataDemo.prospectState != 3) {
					this.$axios.get("/updCaseHandling", {
							params: {
								caseHandling: 1,
								caseState: 2,
								caseId: this.DataDemo.caseId
							}
						})
						.then(msg => {

						});
				} else {
					this.$axios.get("/updCaseHandling", {
							params: {
								caseHandling: 3,
								caseState: 4,
								caseId: this.DataDemo.caseId
							}
						})
						.then(msg => {

						});
				}

				this.dialogSelectVisible = false;
			},
			subCheck() {
				this.updSurveyLossProspectState("查勘审核成功");

				if (this.DataDemo.prospectState == 3) {
					this.$axios.get("/updCaseHandling", {
							params: {
								caseHandling: 3,
								caseState: 4,
								caseId: this.DataDemo.caseId
							}
						})
						.then(msg => {

						});
				}

				this.dialogDataDemoVisible = false;
			},
			subUpload() {
				this.dialogUploadVisible = false;
			},
			submitUpload() {
				this.$refs.upload.submit();
			},
			handleRemove(file, fileList) {
				console.log(file, fileList);
			},
			handlePreview(file) {
				console.log(file);
			},
			subLoss() {
				var Chesum = 0;
				var Wusum = 0;
				var Rensum = 0;
				for (var i = 0; i < this.CheData.length; i++) {
					Chesum += parseFloat(this.CheData[i].carSubtotal);
					this.$axios.post("/updCheLoss", this.CheData[i])
						.then(msg => {});
				}
				for (var i = 0; i < this.WuData.length; i++) {
					Wusum += parseFloat(this.WuData[i].matterSubtotal);
					this.$axios.post("/updWuLoss", this.WuData[i])
						.then(msg => {});
				}
				for (var i = 0; i < this.RenData.length; i++) {
					Rensum += parseFloat(this.RenData[i].userSubtotal);
					this.$axios.post("/updRenLoss", this.RenData[i])
						.then(msg => {});
				}
				if (this.lossStatusOne == 1 && this.lossStatusTwo == 1 && this.lossStatusThree == 1) {
					this.LossData.lossStatus = 1;
				} else {
					this.LossData.lossStatus = 3;
				}
				this.LossData.lossSum = Chesum + Wusum + Rensum;
				this.LossData.caseId = this.DataDemo.caseId;
				this.$axios.post("/updLossDetermination", this.LossData)
					.then(msg => {
						if (msg.data == "成功") {
							this.$notify({
								title: '成功',
								message: '定损信息填写成功',
								type: 'success'
							});
							this.dialogLossVisible = false;
						}
					});
			},
			subSett() {
				if (this.SettUserId == 0) {
					this.$notify({
						title: '提示',
						message: '请选择派工理赔的员工',
						type: 'warning'
					});
				} else {
					for(var i = 0 ; i < this.multipleSelection.length ; i++){
						this.$axios.post("/updSurveyLossSettUserId", {
								caseId: this.multipleSelection[i].caseId,
								settUserId: this.SettUserId
							})
							.then(msg => {
							});
					}
					this.$notify({
						title: '成功',
						message: '理赔派工成功',
						type: 'success'
					});
					this.dialogSettVisible = false;
					this.getProspectAll(1);
				}
			},
			zhProspectState(prospectState) {
				if (prospectState == 1) {
					return "通过";
				} else if (prospectState == 2) {
					return "暂存";
				} else if (prospectState == 3) {
					return "注销";
				} else {
					return "结案";
				}
			},
			zhDisposeType(disposeType) {
				if (disposeType == 1) {
					return "单方事故";
				} else if (disposeType == 2) {
					return "双方事故";
				} else if (disposeType == 3) {
					return "三方事故";
				} else {
					return "多方事故";
				}
			},
			zhDuty(duty) {
				if (duty == 1) {
					return "全部责任";
				} else if (duty == 2) {
					return "主要责任";
				} else if (duty == 3) {
					return "同等责任";
				} else if (duty == 4) {
					return "次要责任";
				} else {
					return "无责任";
				}
			},
			zhLossStatus(lossStatus) {
				if (lossStatus == 1) {
					return "通过";
				} else if (lossStatus == 2) {
					return "未处理";
				} else if (lossStatus == 3) {
					return "暂存";
				} else if (lossStatus == 4) {
					return "待修改";
				} else {
					return "撤销";
				}
			},
			zhcaseHandling(caseHandling) {
				if (caseHandling == 1) {
					return "受理";
				} else if (caseHandling == 2) {
					return "暂存";
				} else if (caseHandling == 3) {
					return "注销";
				}
			},
			zhcaseDispatchedWorkerEndTime(data) {
				var datetime = new Date();
				if (datetime.toLocaleDateString() < data) {
					return "已过期";
				} else {
					return "未过期";
				}
			},
			exit() {
				sessionStorage.clear();
				this.$router.push("/login");
			},
			changeCity: function() { //省切换

				var me = this;
				var item;
				me.items.forEach(function(ele) {
					if (ele.name === me.form.location) { //判断与prov是否相等，相等的表示被切换选中的省份
						item = ele;
					}
				})
				if (item) {
					this.cityArr = item.sub; //将选中的item的sub设置给cityArr 用于显示市
					this.form.city = item.sub[0].name; //默认选择第一个市

					this.cityArr1 = [];
					this.form.county = '';
				}

			},
			changeCity1: function() { //市切换
				var me = this;
				var item;
				me.cityArr.forEach(function(ele) {
					if (ele.name === me.form.city) { //判断与city是否相等，相等的表示被切换选中的市
						item = ele;
					}
				})
				if (item) {
					this.cityArr1 = item.sub; //将选中的item的sub设置给cityArr1 用于显示区
					this.form.county = item.sub[0].name; //默认选择第一个区
				}
			}
		},
		mounted() {
			this.getCaseByUserId(1, 1, 0, 0);
			this.Jurisdictions = JSON.parse(sessionStorage.getItem("Jurisdictions"));
			this.getProspectAll(1);
			this.getSpecialJurisdictions();
		}
	}
</script>

<style scoped>
	.el-header {
		text-align: center;
		line-height: 60px;
	}

	.el-container {
		margin-left: 8px;
	}

	.el-header {
		padding: 0 0;
		border: #A8A8A8 1px solid;
		border-bottom: 0px;
		background-color: white;
	}

	.el-main {
		background-color: white;
		border: #A8A8A8 1px solid;
	}

	.font1 {
		color: #545C64;
		font-size: 14.2px;
	}

	.fo {
		display: flex;
		border: #A8A8A8 1px solid;
		padding-top: 20px;
	}

	/* .el-form-item {
		width: 400px;
	} */

	.el-tabs {
		margin-top: 9px;
	}

	.button {
		margin-top: 20px;
		margin-left: 41px;
	}

	.hover1:hover {
		color: blue;
	}

	.bjys {
		width: 100%;
		height: 40px;
		line-height: 40px;
		background-color: darkorange;
	}
</style>
